import 'package:flutter_deer/generated/json/base/json_convert_content.dart';
import 'package:flutter_deer/database/beans/list_advance_pre_pay_order_entity.dart';

ListAdvancePrePayOrderEntity $ListAdvancePrePayOrderEntityFromJson(Map<String, dynamic> json) {
  final ListAdvancePrePayOrderEntity listAdvancePrePayOrderEntity = ListAdvancePrePayOrderEntity();
  final ListAdvancePrePayOrderEx? ex = jsonConvert.convert<ListAdvancePrePayOrderEx>(json['ex']);
  if (ex != null) {
    listAdvancePrePayOrderEntity.ex = ex;
  }
  final List<ListAdvancePrePayOrderList>? list = (json['list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<ListAdvancePrePayOrderList>(e) as ListAdvancePrePayOrderList).toList();
  if (list != null) {
    listAdvancePrePayOrderEntity.list = list;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    listAdvancePrePayOrderEntity.total = total;
  }
  return listAdvancePrePayOrderEntity;
}

Map<String, dynamic> $ListAdvancePrePayOrderEntityToJson(ListAdvancePrePayOrderEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['ex'] = entity.ex?.toJson();
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['total'] = entity.total;
  return data;
}

extension ListAdvancePrePayOrderEntityExtension on ListAdvancePrePayOrderEntity {
  ListAdvancePrePayOrderEntity copyWith({
    ListAdvancePrePayOrderEx? ex,
    List<ListAdvancePrePayOrderList>? list,
    int? total,
  }) {
    return ListAdvancePrePayOrderEntity()
      ..ex = ex ?? this.ex
      ..list = list ?? this.list
      ..total = total ?? this.total;
  }
}

ListAdvancePrePayOrderEx $ListAdvancePrePayOrderExFromJson(Map<String, dynamic> json) {
  final ListAdvancePrePayOrderEx listAdvancePrePayOrderEx = ListAdvancePrePayOrderEx();
  final int? orderAmount = jsonConvert.convert<int>(json['orderAmount']);
  if (orderAmount != null) {
    listAdvancePrePayOrderEx.orderAmount = orderAmount;
  }
  final int? orderCount = jsonConvert.convert<int>(json['orderCount']);
  if (orderCount != null) {
    listAdvancePrePayOrderEx.orderCount = orderCount;
  }
  return listAdvancePrePayOrderEx;
}

Map<String, dynamic> $ListAdvancePrePayOrderExToJson(ListAdvancePrePayOrderEx entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['orderAmount'] = entity.orderAmount;
  data['orderCount'] = entity.orderCount;
  return data;
}

extension ListAdvancePrePayOrderExExtension on ListAdvancePrePayOrderEx {
  ListAdvancePrePayOrderEx copyWith({
    int? orderAmount,
    int? orderCount,
  }) {
    return ListAdvancePrePayOrderEx()
      ..orderAmount = orderAmount ?? this.orderAmount
      ..orderCount = orderCount ?? this.orderCount;
  }
}

ListAdvancePrePayOrderList $ListAdvancePrePayOrderListFromJson(Map<String, dynamic> json) {
  final ListAdvancePrePayOrderList listAdvancePrePayOrderList = ListAdvancePrePayOrderList();
  final List<dynamic>? goodsNameList = (json['goodsNameList'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (goodsNameList != null) {
    listAdvancePrePayOrderList.goodsNameList = goodsNameList;
  }
  final String? orderAmount = jsonConvert.convert<String>(json['orderAmount']);
  if (orderAmount != null) {
    listAdvancePrePayOrderList.orderAmount = orderAmount;
  }
  final String? orderId = jsonConvert.convert<String>(json['orderId']);
  if (orderId != null) {
    listAdvancePrePayOrderList.orderId = orderId;
  }
  final String? payTime = jsonConvert.convert<String>(json['payTime']);
  if (payTime != null) {
    listAdvancePrePayOrderList.payTime = payTime;
  }
  final String? payTypeNames = jsonConvert.convert<String>(json['payTypeNames']);
  if (payTypeNames != null) {
    listAdvancePrePayOrderList.payTypeNames = payTypeNames;
  }
  final String? phone = jsonConvert.convert<String>(json['phone']);
  if (phone != null) {
    listAdvancePrePayOrderList.phone = phone;
  }
  final List<dynamic>? shelfNoList = (json['shelfNoList'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (shelfNoList != null) {
    listAdvancePrePayOrderList.shelfNoList = shelfNoList;
  }
  final String? energyOrderId = jsonConvert.convert<String>(json['energyOrderId']);
  if (energyOrderId != null) {
    listAdvancePrePayOrderList.energyOrderId = energyOrderId;
  }
  final String? shelfNo = jsonConvert.convert<String>(json['shelfNo']);
  if (shelfNo != null) {
    listAdvancePrePayOrderList.shelfNo = shelfNo;
  }
  final String? goodsQuantity = jsonConvert.convert<String>(json['goodsQuantity']);
  if (goodsQuantity != null) {
    listAdvancePrePayOrderList.goodsQuantity = goodsQuantity;
  }
  final String? goodsTotalPrice = jsonConvert.convert<String>(json['goodsTotalPrice']);
  if (goodsTotalPrice != null) {
    listAdvancePrePayOrderList.goodsTotalPrice = goodsTotalPrice;
  }
  final String? goodsUnit = jsonConvert.convert<String>(json['goodsUnit']);
  if (goodsUnit != null) {
    listAdvancePrePayOrderList.goodsUnit = goodsUnit;
  }
  final String? mchGoodsName = jsonConvert.convert<String>(json['mchGoodsName']);
  if (mchGoodsName != null) {
    listAdvancePrePayOrderList.mchGoodsName = mchGoodsName;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    listAdvancePrePayOrderList.createTime = createTime;
  }
  return listAdvancePrePayOrderList;
}

Map<String, dynamic> $ListAdvancePrePayOrderListToJson(ListAdvancePrePayOrderList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['goodsNameList'] = entity.goodsNameList;
  data['orderAmount'] = entity.orderAmount;
  data['orderId'] = entity.orderId;
  data['payTime'] = entity.payTime;
  data['payTypeNames'] = entity.payTypeNames;
  data['phone'] = entity.phone;
  data['shelfNoList'] = entity.shelfNoList;
  data['energyOrderId'] = entity.energyOrderId;
  data['shelfNo'] = entity.shelfNo;
  data['goodsQuantity'] = entity.goodsQuantity;
  data['goodsTotalPrice'] = entity.goodsTotalPrice;
  data['goodsUnit'] = entity.goodsUnit;
  data['mchGoodsName'] = entity.mchGoodsName;
  data['createTime'] = entity.createTime;
  return data;
}

extension ListAdvancePrePayOrderListExtension on ListAdvancePrePayOrderList {
  ListAdvancePrePayOrderList copyWith({
    List<dynamic>? goodsNameList,
    String? orderAmount,
    String? orderId,
    String? payTime,
    String? payTypeNames,
    String? phone,
    List<dynamic>? shelfNoList,
    String? energyOrderId,
    String? shelfNo,
    String? goodsQuantity,
    String? goodsTotalPrice,
    String? goodsUnit,
    String? mchGoodsName,
    String? createTime,
  }) {
    return ListAdvancePrePayOrderList()
      ..goodsNameList = goodsNameList ?? this.goodsNameList
      ..orderAmount = orderAmount ?? this.orderAmount
      ..orderId = orderId ?? this.orderId
      ..payTime = payTime ?? this.payTime
      ..payTypeNames = payTypeNames ?? this.payTypeNames
      ..phone = phone ?? this.phone
      ..shelfNoList = shelfNoList ?? this.shelfNoList
      ..energyOrderId = energyOrderId ?? this.energyOrderId
      ..shelfNo = shelfNo ?? this.shelfNo
      ..goodsQuantity = goodsQuantity ?? this.goodsQuantity
      ..goodsTotalPrice = goodsTotalPrice ?? this.goodsTotalPrice
      ..goodsUnit = goodsUnit ?? this.goodsUnit
      ..mchGoodsName = mchGoodsName ?? this.mchGoodsName
      ..createTime = createTime ?? this.createTime;
  }
}